﻿Imports System.Data.SqlClient

Public Class clsPUESTOS
    Private cnConn As New SqlConnection
    Private Command As SqlCommand

    Public Sub CONECTA_BD()
        cnConn.ConnectionString = CitraConnection

        Command = New SqlCommand("sp_PUESTOS_INSERTA", cnConn)
        Command.CommandType = CommandType.StoredProcedure
        Command.CommandTimeout = 0


        Command.Parameters.Add(New SqlParameter("@CLAVE", SqlDbType.VarChar, 30))
        Command.Parameters.Add(New SqlParameter("@NOMBRE", SqlDbType.VarChar, 200))
        Command.Parameters.Add(New SqlParameter("@SUELDO_SUG", SqlDbType.Decimal))
        Command.Parameters.Add(New SqlParameter("@SUELDO_MAX", SqlDbType.Decimal))

        Try
            cnConn.Open()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information, "Aviso")
            If cnConn.State = ConnectionState.Open Then
                cnConn.Close()
            End If
        End Try
    End Sub
    Public Sub GUARDA_PUESTO(ByVal CLAVE As String, ByVal NOMBRE As String, ByVal SUELDO_SUGERIDO As Double, ByVal SUELDO_MAXIMO As Double)
        Command.Parameters("@CLAVE").Value = CLAVE
        Command.Parameters("@NOMBRE").Value = NOMBRE
        Command.Parameters("@SUELDO_SUG").Value = SUELDO_SUGERIDO
        Command.Parameters("@SUELDO_MAX").Value = SUELDO_MAXIMO

        Try
            Command.ExecuteNonQuery()
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information, "Aviso")

        End Try


    End Sub
    Public Sub Cerrar_BD()
        If cnConn.State = ConnectionState.Open Then
            cnConn.Close()
        End If
    End Sub

End Class
